<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<%
dim aa,bb, bb1,bb2,bb3,bb4, Description

Description=request("D")
if isEmpty(Description) then Description=""
Description=Mid(Description,1,512)
if Description="No" then
%>
<Result>
No
</Result>
<%
response.end
end if


aa=Request.ServerVariables("LOGON_USER")
bb=Request.Querystring("AN")
if Request.Querystring("Cd")<>"Reset" THEN
if instr(1,aa, bb,1)=0 THEN
response.clear
%>
<Result>
Non
</Result>
<%
response.end
end if
end if

aa=Request.ServerVariables("HTTP_USER_AGENT")
bb1="Indy"
bb2="idealer.gate"
bb3="moneyps.gate"
bb4="moneyps.tpo.core"
if (instr(1,aa, bb1,1)=0) and (instr(1,aa, bb2,1)=0) and (instr(1,aa, bb3,1)=0) and (instr(1,aa, bb4,1)=0) THEN

response.clear
response.end
end if
%>
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->
<%
dim Node,  CN, DTA, Ph, cl, bn,bs
Node=request("Node")
if isEmpty(Node) then Node="_P"
CN=request("CN")
if isEmpty(CN) then CN=""
Cl=request("CL")
if isEmpty(Cl) then Cl=""
BS=request("BS")
if isEmpty(BS) then BS=""
BN=request("BN")
if isEmpty(BN) then BN=""
DTA=request("DTA")
if isEmpty(DTA) then DTA=""
Ph=request("Ph")
if isEmpty(Ph) then Ph=""

	Dim cnn
	Dim connStr
	dim cmd
	dim R
	Set cnn=Server.CreateObject("ADODB.Connection")
    Set cmd=Server.CreateObject("ADODB.Command")
%>
<!-- #INCLUDE FILE="Connection.inc" -->
<%
''''	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=EM-HOME"
	cnn.open connStr
	Set cmd.ActiveConnection = cnn
	cmd.CommandType=adCmdStoredProc
	cmd.CommandText = "sp_AutomatIncasso"
	
	Cmd.Parameters.Append Cmd.CreateParameter("@AutomatNumber", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@Phone", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@Code", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@Description", adVarChar, adParamInput,512)
	Cmd.Parameters.Append Cmd.CreateParameter("@CN", adVarChar, adParamInput,19)
	Cmd.Parameters.Append Cmd.CreateParameter("@CL", adVarChar, adParamInput,32)
	Cmd.Parameters.Append Cmd.CreateParameter("@BS", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@BN", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@DTA", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@id", adInteger, adParamOutput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Res", adInteger, adParamOutput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Result", adVarChar, adParamOutput,160)
	Cmd("@AutomatNumber")=Request.Querystring("AN")
	Cmd("@Phone")=Ph
	Cmd("@Code")=Request.Querystring("Cd")
	Cmd("@Description")=Description
	Cmd("@CN")=CN
	Cmd("@CL")=CL
	Cmd("@BS")=BS
	Cmd("@BN")=BN
	Cmd("@DTA")=DTA
	cmd.execute
	%>
<%=Cmd("@Result")%>
<%
	set cmd=nothing
	cnn.close
	set cnn=nothing
%>
